version: '3.6'

services:
  flask1:
    build: ./flask
    ports:
      - "5002:5000"
    networks:
      - internal
    restart: unless-stopped
    container_name: flask1
  flask2:
    build: ./flask
    ports:
      - "5001:5000"
    networks:
      - internal
    restart: unless-stopped
    container_name: flask2  
  balancer:
    image: nginx:latest
    ports:
      - "80:80"
      - "443:443"  
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/nginx-selfsigned.crt:/etc/ssl/certs/nginx-selfsigned.crt
      - ./nginx/nginx-selfsigned.key:/etc/ssl/private/nginx-selfsigned.key
      - ./nginx/dnsmasq.conf:/etc/dnsmasq.conf
    networks:
      - internal
      - external
    restart: unless-stopped
    container_name: nginx
  dnsmasq:
    image: andyshinn/dnsmasq
    command: --log-facility=-
    ports:
      - "5100:53/tcp"
      - "5100:53/udp" 
    volumes:
      - ./nginx/dnsmasq.conf:/etc/dnsmasq.conf
      - ./nginx/hosts:/etc/hosts
    networks:
      - internal
      - external
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
    container_name: dnsmasq    

      
networks:
  internal:
  external:  
